package com.example.sls.controller.field;

import com.example.sls.pojo.field.PromoCodes;
import com.example.sls.service.intserfaces.field.PromoCodesService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 优惠代码表(PromoCodes)表控制层
 *
 * @author 蓝江富
 * @since 2024-06-19 13:23:44
 */
@RestController
@RequestMapping("field/promoCodes")
public class PromoCodesController {
  @Autowired
  PromoCodesService promoCodesService;

  @GetMapping("queryById")
  PromoCodes queryById(Integer id) {
    return promoCodesService.queryById(id);
  }

  @GetMapping("queryAllByLimit")
  List<PromoCodes> queryAllByLimit(PromoCodes promoCodes, Integer pageSize, Integer offset) {
    return promoCodesService.queryAllByLimit(promoCodes, pageSize, offset);
  }

  @GetMapping("count")
  long count() {
    return promoCodesService.count();
  }

  @GetMapping("insert")
  int insert(PromoCodes promoCodes) {
    return promoCodesService.insert(promoCodes);
  }

  @GetMapping("update")
  int update(PromoCodes promoCodes) {
    return promoCodesService.update(promoCodes);
  }

  @GetMapping("deleteById")
  int deleteById(Integer id) {
    return promoCodesService.deleteById(id);
  }
}

